/**
 * 
 */
package com.bar.carta.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.bar.carta.model.impl.TipoImpl;

/**
 * @author pgonzalm
 *
 */
public class TipoDTO extends TipoImpl{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private String name;
	
	private String description;
	
	private int language;
	
	/**
	 * Idiomas.
	 */
	private Map<Integer,LanguageDTO> languages;
	
	/**
	 * Constructor.
	 * @param tipo
	 */
	public TipoDTO(Tipo tipo){
		super();
		setTipoId(tipo.getTipoId());
		setActivo(tipo.isActivo());
		
		languages = new HashMap<Integer, LanguageDTO>();
	}
	
	/**
	 * Constructor por defecto.
	 */
	public TipoDTO(){
		super();
		languages = new HashMap<Integer, LanguageDTO>();
	}
	
	/**
	 * @return the name
	 */
	public String getName() {
		if (languages.get(language) != null ){
			name = languages.get(language).getName();
		}
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		if (languages.get(language) != null ){
			description = languages.get(language).getDescription();
		}
		return description;
	}

	/**
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @return the language
	 */
	public int getLanguage() {
		return language;
	}

	/**
	 * @param language the language to set
	 */
	public void setLanguage(int language) {
		this.language = language;
	}

	/**
	 * @return the languages
	 */
	public Map<Integer,LanguageDTO> getLanguages() {
		return languages;
	}

	/**
	 * @param languages the languages to set
	 */
	public void setLanguages(Map<Integer,LanguageDTO> languages) {
		this.languages = languages;
	}

}
